From 72cba72e8eb5a12b43db7cf1e16324c9da3ae609 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Thu, 30 Sep 2021 02:02:29 -0700 Subject: [PATCH] =?UTF-8?q?feat:=20New=20Crowdin=20translations=20(auto-me?= =?UTF-8?q?rged=20=F0=9F=A4=96)=20(#2064)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../debugging-instructions-macos.md | 4 +- content/de-DE/docs/tutorial/devices.md | 56 +++++++++++++++++++ content/es-ES/docs/breaking-changes.md | 26 ++++----- .../docs/development/build-instructions-gn.md | 2 +- .../development/build-instructions-windows.md | 2 +- .../debugging-instructions-macos.md | 6 +- content/es-ES/docs/glossary.md | 8 +-- content/es-ES/docs/tutorial/code-signing.md | 6 +- .../es-ES/docs/tutorial/context-isolation.md | 4 +- content/es-ES/docs/tutorial/dark-mode.md | 2 +- .../es-ES/docs/tutorial/debugging-vscode.md | 6 +- content/es-ES/docs/tutorial/devices.md | 56 +++++++++++++++++++ .../es-ES/docs/tutorial/electron-timelines.md | 2 +- .../launch-app-from-url-in-another-app.md | 12 ++-- content/es-ES/docs/tutorial/notifications.md | 10 ++-- content/es-ES/docs/tutorial/performance.md | 2 +- content/es-ES/docs/tutorial/support.md | 2 +- .../debugging-instructions-macos.md | 4 +- content/fr-FR/docs/tutorial/devices.md | 56 +++++++++++++++++++ .../debugging-instructions-macos.md | 4 +- content/ja-JP/docs/tutorial/devices.md | 56 +++++++++++++++++++ .../debugging-instructions-macos.md | 4 +- content/pt-BR/docs/tutorial/devices.md | 56 +++++++++++++++++++ .../debugging-instructions-macos.md | 4 +- content/ru-RU/docs/tutorial/devices.md | 56 +++++++++++++++++++ .../debugging-instructions-macos.md | 4 +- content/zh-CN/docs/tutorial/devices.md | 56 +++++++++++++++++++ 27 files changed, 456 insertions(+), 50 deletions(-) create mode 100644 content/de-DE/docs/tutorial/devices.md create mode 100644 content/es-ES/docs/tutorial/devices.md create mode 100644 content/fr-FR/docs/tutorial/devices.md create mode 100644 content/ja-JP/docs/tutorial/devices.md create mode 100644 content/pt-BR/docs/tutorial/devices.md create mode 100644 content/ru-RU/docs/tutorial/devices.md create mode 100644 content/zh-CN/docs/tutorial/devices.md diff --git a/content/de-DE/docs/development/debugging-instructions-macos.md b/content/de-DE/docs/development/debugging-instructions-macos.md index 2c0c107e979e4..5de037e999983 100644 --- a/content/de-DE/docs/development/debugging-instructions-macos.md +++ b/content/de-DE/docs/development/debugging-instructions-macos.md @@ -11,7 +11,9 @@ Wenn Sie Abstürze oder Probleme in Electron auftreten, von denen Sie glauben, d * **.lldbinit**: Create or edit `~/.lldbinit` to allow Chromium code to be properly source-mapped. ```text - command script import ~/electron/src/tools/lldb/lldbinit.py + # e.g: ['~/electron/src/tools/lldb'] + script sys.path[:0] = ['<...path/to/electron/src/tools/lldb>'] + script import lldbinit ``` ## Attaching to and Debugging Electron diff --git a/content/de-DE/docs/tutorial/devices.md b/content/de-DE/docs/tutorial/devices.md new file mode 100644 index 0000000000000..7d782fff7da9c --- /dev/null +++ b/content/de-DE/docs/tutorial/devices.md @@ -0,0 +1,56 @@ +# Device Access + +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. + +## Web Bluetooth API + +The [Web Bluetooth API](https://web.dev/bluetooth/) can be used to communicate with bluetooth devices. In order to use this API in Electron, developers will need to handle the [`select-bluetooth-device` event on the webContents](../api/web-contents.md#event-select-bluetooth-device) associated with the device request. + +### Beispiel + +This example demonstrates an Electron application that automatically selects the first available bluetooth device when the `Test Bluetooth` button is clicked. + +```javascript fiddle='docs/fiddles/features/web-bluetooth' + +``` + +## WebHID API + +The [WebHID API](https://web.dev/hid/) can be used to access HID devices such as keyboards and gamepads. Electron provides several APIs for working with the WebHID API: + +* The [`select-hid-device` event on the Session](../api/session.md#event-select-hid-device) can be used to select a HID device when a call to `navigator.hid.requestDevice` is made. Additionally the [`hid-device-added`](../api/session.md#event-hid-device-added) and [`hid-device-removed`](../api/session.md#event-hid-device-removed) events on the Session can be used to handle devices being plugged in or unplugged during the `navigator.hid.requestDevice` process. +* [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler) can be used to provide default permissioning to devices without first calling for permission to devices via `navigator.hid.requestDevice`. 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 `select-hid-device` event) and then read from that storage with `setDevicePermissionHandler`. +* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler) can be used to disable HID access for specific origins. + +### Blocklist + +By default Electron employs the same [blocklist](https://github.com/WICG/webhid/blob/main/blocklist.txt) used by Chromium. If you wish to override this behavior, you can do so by setting the `disable-hid-blocklist` flag: + +```javascript +app.commandLine.appendSwitch('disable-hid-blocklist') +``` + +### Beispiel + +This example demonstrates an Electron application that automatically selects HID devices through [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler) and through [`select-hid-device` event on the Session](../api/session.md#event-select-hid-device) when the `Test WebHID` button is clicked. + +```javascript fiddle='docs/fiddles/features/web-hid' + +``` + +## Web Serial API + +The [Web Serial API](https://web.dev/serial/) 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 [`select-serial-port` event on the Session](../api/session.md#event-select-serial-port) associated with the serial port request. + +There are several additional APIs for working with the Web Serial API: + +* The [`serial-port-added`](../api/session.md#event-serial-port-added) and [`serial-port-removed`](../api/session.md#event-serial-port-removed) events on the Session can be used to handle devices being plugged in or unplugged during the `navigator.serial.requestPort` process. +* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler) can be used to disable serial access for specific origins. + +### Beispiel + +This example demonstrates an Electron application that automatically selects the first available Arduino Uno serial device (if connected) through [`select-serial-port` event on the Session](../api/session.md#event-select-serial-port) when the `Test Web Serial` button is clicked. + +```javascript fiddle='docs/fiddles/features/web-serial' + +``` diff --git a/content/es-ES/docs/breaking-changes.md b/content/es-ES/docs/breaking-changes.md index 824ff1690fd0a..c8361ce41d244 100644 --- a/content/es-ES/docs/breaking-changes.md +++ b/content/es-ES/docs/breaking-changes.md @@ -497,7 +497,7 @@ Chromium ha eliminado el soporte para cambiar los limites del nivel de zoom del ### Comportamiento Modificado: Enviando objetos no JS sobre IPC ahora lanza una excepción -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. `Element`, `Location` and `DOMMatrix`), Node.js objects backed by C++ classes (e.g. `process.env`, some members of `Stream`), and Electron objects backed by C++ classes (e.g. `WebContents`, `BrowserWindow` and `WebFrame`) are not serializable with Structured Clone. Whenever the old algorithm was invoked, a deprecation warning was printed. +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. `Element`, `Location` and `DOMMatrix`), Node.js objects backed by C++ classes (e.g. `process.env`, some members of `Stream`), and Electron objects backed by C++ classes (e.g. `WebContents`, `BrowserWindow` and `WebFrame`) are not serializable with Structured Clone. Siempre que se invocaba el algoritmo anterior, se imprimía una advertencia de desaprobación. 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". @@ -507,7 +507,7 @@ La API `shell.openItem` ha sido reemplazada con una API asíncrona `shell.openPa ## Cambios planeados en la API(8.0) -### Behavior Changed: Values sent over IPC are now serialized with Structured Clone Algorithm +### Comportamiento Cambiado: Los valores enviados sobre IPC ahora son serializados con Algoritmo de Clon Estructurado El algoritmo usado para serializar los objetos enviados sobre IPC (mediante `ipcRenderer.send`, `ipcRenderer.sendSync`, `WebContents.send` y métodos relacionados) han sido cambiados de un algoritmo personalizado a los de V8 [Structured Clone Algorithm][SCA], el mismo algoritmo usado para serializar los mensajes para `postMessage`. Esto conlleva una mejora en el rendimiento de 2x para mensajes grandes, pero también trae algunos cambios de comportamiento. @@ -582,14 +582,14 @@ ipcRenderer.invoke('openDevTools', webview.getWebContentsId()) 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 [here](https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11). -### Deprecated events in `systemPreferences` +### Eventos obsoletos en `systemPreferences` -The following `systemPreferences` events have been deprecated: +Los siguientes eventos `systemPreferences` han sido marcados como obsoletos: * `inverted-color-scheme-changed` * `high-contrast-color-scheme-changed` -Use the new `updated` event on the `nativeTheme` module instead. +Use el nuevo evento `updated` en el módulo `nativeTheme` en su lugar. ```js // Obsoleto @@ -600,7 +600,7 @@ systemPreferences.on('high-contrast-color-scheme-changed', () => { /* ... */ }) nativeTheme.on('updated', () => { /* ... */ }) ``` -### Deprecated: methods in `systemPreferences` +### Obsoleto: métodos en `systemPreferences` Los métodos siguientes de `systemPreferences` han quedado obsoletos: @@ -637,9 +637,9 @@ nativeTheme.shouldUseHighContrastColors Este es el URL especificado como `disturl` en un archivo `.npmrc` o como el comando de linea `--dist-url` al construir los módulos nativos de nodo. Ambos serán admitidos para el futuro previsible, pero se recomienda que cambies. -Deprecated: https://atom.io/download/electron +Obsoleto: https://atom.io/download/electron -Replace with: https://electronjs.org/headers +Reemplazar con: https://electronjs.org/headers ### API Modificada: `session.clearAuthCache()` ya no acepta opciones @@ -720,7 +720,7 @@ En Electron 7, esto ahora retorna un `FileList` con un objeto `File` para: /path/to/folder/file1 ``` -Note that `webkitdirectory` no longer exposes the path to the selected folder. Si requieras la ruta a la carpeta seleccionada en lugar de los contenidos de la carpeta, ver el `Dialog. showOpenDialog` API ([Link](api/dialog.md#dialogshowopendialogbrowserwindow-options)). +Tenga en cuenta que `webkitdirectory` 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 `Dialog. showOpenDialog` API ([Link](api/dialog.md#dialogshowopendialogbrowserwindow-options)). ### API Modificada: Versiones basadas en Callback de APIs promisificadas @@ -789,7 +789,7 @@ require('electron').screen require('electron').remote.screen ``` -### API Changed: `require()`ing node builtins in sandboxed renderers no longer implicitly loads the `remote` version +### API Modificada: `require()` los ing integrados de node builtins en renderizadores sandboxed no carga más de forma implícita la versión `remote` ```js // Deprecado @@ -852,7 +852,7 @@ tray.setHighlightMode(mode) ## Cambios Planeados en la API (5.0) -### Default Changed: `nodeIntegration` and `webviewTag` default to false, `contextIsolation` defaults to true +### Valor por defecto modificado: `nodeIntegration` y `webviewTag` por defecto a false, `contextIsolation` por defecto a true Los siguientes valores por defectos de opción `webPreferences` están obsoletos a favor de los nuevos valores por defectos listados a continuación. @@ -862,7 +862,7 @@ Los siguientes valores por defectos de opción `webPreferences` están obsoletos | `nodeIntegration` | `true` | `false` | | `webviewTag` | `nodeIntegration` if set else `true` | `false` | -P.e. Re-enabling the webviewTag +P.e. Volver a habilitar el webviewTag ```js const w = new BrowserWindow({ @@ -880,7 +880,7 @@ Child windows opened with the `nativeWindowOpen` option will always have Node.js Renderer process APIs `webFrame.registerURLSchemeAsPrivileged` and `webFrame.registerURLSchemeAsBypassingCSP` as well as browser process API `protocol.registerStandardSchemes` have been removed. Una nueva API, `protocol.registerSchemesAsPrivileged` 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. -### Deprecated: `webFrame.setIsolatedWorld*` replaced with `webFrame.setIsolatedWorldInfo` +### Obsoleto: `webFrame.setIsolatedWorld*` reemplazado con `webFrame.setIsolatedWorldInfo` ```js // Deprecated diff --git a/content/es-ES/docs/development/build-instructions-gn.md b/content/es-ES/docs/development/build-instructions-gn.md index 23f18badcd3db..b2fae773b3141 100644 --- a/content/es-ES/docs/development/build-instructions-gn.md +++ b/content/es-ES/docs/development/build-instructions-gn.md @@ -10,7 +10,7 @@ Comprueba los pre-requisitos de tu plataforma para la compilación antes de avan * [Linux](build-instructions-linux.md#prerequisites) * [Windows](build-instructions-windows.md#prerequisites) -## Build Tools +## Herramientas de construcción [Electron's Build Tools](https://github.com/electron/build-tools) 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. diff --git a/content/es-ES/docs/development/build-instructions-windows.md b/content/es-ES/docs/development/build-instructions-windows.md index 0b7bbf48e761f..067f770fd08b4 100644 --- a/content/es-ES/docs/development/build-instructions-windows.md +++ b/content/es-ES/docs/development/build-instructions-windows.md @@ -29,7 +29,7 @@ Windows Security doesn't like one of the files in the Chromium source code (see ## Compilando -See [Build Instructions: GN](build-instructions-gn.md) +Ver [Build Instructions: GN](build-instructions-gn.md) ## Arquitectura 32bit diff --git a/content/es-ES/docs/development/debugging-instructions-macos.md b/content/es-ES/docs/development/debugging-instructions-macos.md index 6dab932cb1f7c..7b2a851a779a2 100644 --- a/content/es-ES/docs/development/debugging-instructions-macos.md +++ b/content/es-ES/docs/development/debugging-instructions-macos.md @@ -11,7 +11,9 @@ Si usted tiene bloqueos o problemas en Electron que cree que no son causados ​ * **.lldbinit**: Crear o editar `~/.lldbinit` para permitir que el código de Chromium sea correctamente mapeado de fuentes. ```text - command script import ~/electron/src/tools/lldb/lldbinit.py + # p. ej.: [' ~/electron/src/tools/lldb '] + script sys. Path [: 0] = ['<... path/to/electron/src/tools/lldb>'] + script import lldbinit ``` ## A y depuración Electron @@ -87,7 +89,7 @@ Process 25244 stopped 122 return badge_count_; ``` -**NOTE:** If you don't see source code when you think you should, you may not have added the `~/.lldbinit` file above. +**NOTA:** Si no ves el código fuente cuando crees que deberías, es posible que no hayas añadido el archivo `~/.lldbinit` anterior. Para finalizar la depuración en este punto, corra `continuar proceso`. También puede continuar hasta cierta linea es tocada en este hilo (`hilo hasta 100`). 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. diff --git a/content/es-ES/docs/glossary.md b/content/es-ES/docs/glossary.md index c65a5f532a6b8..145d1b0d32894 100644 --- a/content/es-ES/docs/glossary.md +++ b/content/es-ES/docs/glossary.md @@ -36,7 +36,7 @@ Método de entrada del editor. Un programa que permite a los usuarios introducir ### IDL -Interface description language. Escribe firmas de funciones y tipos de datos en un formato que se puede utilizar para generar interfaces en Java, C++, JavaScript, etc. +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. ### IPC @@ -108,7 +108,7 @@ Véase también: [proceso principal](#main-process), [proceso de renderizado](#r ### proceso de renderizado -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. They can also be hidden. +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. Véase también: [proceso](#process), [proceso principal](#main-process) @@ -132,11 +132,11 @@ Como Node, Electron se centra en tener un pequeño conjunto de APIs que proporci ### V8 -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. +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++. Electrón forma V8 como parte de Chromium y luego apunta el Nodo ese V8 cuando lo está formando. -V8's version numbers always correspond to those of Google Chrome. Chrome 59 includes V8 5.9, Chrome 58 includes V8 5.8, etc. +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. - [v8.dev](https://v8.dev/) - [nodejs.org/api/v8.html](https://nodejs.org/api/v8.html) diff --git a/content/es-ES/docs/tutorial/code-signing.md b/content/es-ES/docs/tutorial/code-signing.md index 7f57b360117a5..3365b4cdd64c7 100644 --- a/content/es-ES/docs/tutorial/code-signing.md +++ b/content/es-ES/docs/tutorial/code-signing.md @@ -93,7 +93,7 @@ const { systemPreferences } = require('electron') const microphone = systemPreferences.askForMediaAccess('microphone') ``` -Your app may crash. See the Resource Access section in [Hardened Runtime](https://developer.apple.com/documentation/security/hardened_runtime) for more information and entitlements you may need. +Puede que tu aplicación falle. See the Resource Access section in [Hardened Runtime](https://developer.apple.com/documentation/security/hardened_runtime) for more information and entitlements you may need. ## `Electron-builder` @@ -143,7 +143,7 @@ Up until Electron 12, the `com.apple.security.cs.allow-unsigned-executable-memor ## Mac App Store -See the [Mac App Store Guide][]. +Ver la [Mac App Store Guide][]. # Firmando compilaciones Windows @@ -166,7 +166,7 @@ Hay una serie de herramientas para firmar su aplicación empaquetada: ## Windows Store -See the [Windows Store Guide][]. +Ver la [Windows Store Guide][]. [Apple Developer Program]: https://developer.apple.com/programs/ [`electron-builder`]: https://github.com/electron-userland/electron-builder diff --git a/content/es-ES/docs/tutorial/context-isolation.md b/content/es-ES/docs/tutorial/context-isolation.md index f68331adfe864..6eb22ea529abd 100644 --- a/content/es-ES/docs/tutorial/context-isolation.md +++ b/content/es-ES/docs/tutorial/context-isolation.md @@ -1,6 +1,6 @@ -# Context Isolation +# Aislamiento del contexto -## What is it? +## ¿Qué es? Context Isolation is a feature that ensures that both your `preload` scripts and Electron's internal logic run in a separate context to the website you load in a [`webContents`](../api/web-contents.md). 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. diff --git a/content/es-ES/docs/tutorial/dark-mode.md b/content/es-ES/docs/tutorial/dark-mode.md index ac1dabe6b025b..4d5d0dfe1a3bd 100644 --- a/content/es-ES/docs/tutorial/dark-mode.md +++ b/content/es-ES/docs/tutorial/dark-mode.md @@ -14,7 +14,7 @@ If your app has its own dark mode, you should toggle it on and off in sync with Si quieres cambiar manualmente entre los modos light/dark, puedes hacerlo configurando el modo deseado en la propiedad [themeSource](../api/native-theme.md#nativethemethemesource) del módulo `nativeTheme`. This property's value will be propagated to your Renderer process. Any CSS rules related to `prefers-color-scheme` will be updated accordingly. -## macOS settings +## configuraciones macOS En macOS 10.14 Mojave, Apple introdujo un nuevo modo oscuro [para todo el sistema][system-wide-dark-mode] en sus ordenadores macOS. If your Electron app has a dark mode, you can make it follow the system-wide dark mode setting using [the `nativeTheme` api](../api/native-theme.md). diff --git a/content/es-ES/docs/tutorial/debugging-vscode.md b/content/es-ES/docs/tutorial/debugging-vscode.md index 3c3c9c45aec49..c0147c37391bb 100644 --- a/content/es-ES/docs/tutorial/debugging-vscode.md +++ b/content/es-ES/docs/tutorial/debugging-vscode.md @@ -35,13 +35,13 @@ $ code electron-quick-start } ``` -#### 3. Debugging +#### 3. Depuración Set some breakpoints in `main.js`, and start debugging in the [Debug View](https://code.visualstudio.com/docs/editor/debugging). You should be able to hit the breakpoints. Aquí hay un proyecto preconfigurado que puede descargar y depurar directamente en VSCode: https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start -## Debugging the Electron codebase +## Depurando el código base de Electron If you want to build Electron from source and modify the native Electron codebase, this section will help you in testing your modifications. @@ -94,6 +94,6 @@ $ code electron-quick-start * `your-directory-name`: If you modified this during your build process from the default, this will be whatever you specified. * The `args` array string `"your-electron-project-path"` should be the absolute path to either the directory or `main.js` file of the Electron project you are using for testing. In this example, it should be your path to `electron-quick-start`. -#### 3. Debugging +#### 3. Depuración Set some breakpoints in the .cc files of your choosing in the native Electron C++ code, and start debugging in the [Debug View](https://code.visualstudio.com/docs/editor/debugging). diff --git a/content/es-ES/docs/tutorial/devices.md b/content/es-ES/docs/tutorial/devices.md new file mode 100644 index 0000000000000..91edf408ab6ba --- /dev/null +++ b/content/es-ES/docs/tutorial/devices.md @@ -0,0 +1,56 @@ +# Acceso del dispositivo + +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. + +## API Web Bluetooth + +La [Web Bluetooth API](https://web.dev/bluetooth/) puede ser utilizada para comunicarse con dispositivos bluetooth. Para poder utilizar esta API en Electron, los desarrolladores necesitan manejar el [evento `select-bluetooth-device` en el webContents](../api/web-contents.md#event-select-bluetooth-device) asociado con la solicitud del dispositivo. + +### Ejemplo + +Este ejemplo demuestra un aplicación Electron que automáticamente selecciona el primer dispositivo bluetooth disponible cuando el botón `Test Bluetooth` es pulsado. + +```javascript fiddle='docs/fiddles/features/web-bluetooth' + +``` + +## API WebHID + +La [WebHID API](https://web.dev/hid/) puede ser usada para acceder a dispositivos HID tales como teclados y gamepads. Electron proporciona varias APIs, para trabajar con la API WebHID: + +* El [evento `select-hid-device` en la Session](../api/session.md#event-select-hid-device) puede ser usado para seleccionar un dispositivo HID cuando se hace una llamada a `navigator.hid.requestDevice`. Adicionalmente, los eventos [`hid-device-added`](../api/session.md#event-hid-device-added) y [`hid-device-removed`](../api/session.md#event-hid-device-removed) en la Session pueden ser utilizados para manejar dispositivos que se conectan o desconectan durante el proceso `navigator.hid.requestDevice`. +* [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler) puede ser utilizado para proveer permisos predeterminados a los dispositivos sin llamar primero para obtener permiso a dispositivo a través de `navigator.hid.requestDevice`. 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 `select-hid-device`) y luego leer desde ese almacenamiento con `setDevicePermissionHandler`. +* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler) puede ser usado para desactivar el acceso a HID a orígenes específicos. + +### Lista de bloqueados + +Por defecto Electron emplea la misma [blocklist](https://github.com/WICG/webhid/blob/main/blocklist.txt) usada por Chromium. Si desea anular este comportamiento, puede hacerlo estableciendo la bandera `disable-hid-blocklist`: + +```javascript +app.commandLine.appendSwitch('disable-hid-blocklist') +``` + +### Ejemplo + +Este ejemplo demuestra una aplicación Electron que automáticamente selecciona dispositivos HID a través de [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler) y a través del [evento `select-hid-device` en la Session](../api/session.md#event-select-hid-device) cuando el botón `Test WebHID` es pulsado. + +```javascript fiddle='docs/fiddles/features/web-hid' + +``` + +## API Serial Web + +La [Web Serial API](https://web.dev/serial/) 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 [evento `select-serial-port` en la Session](../api/session.md#event-select-serial-port) asociado con la solicitud de puerto serial. + +Hay varias APIs adicionales para trabajar con la API Web Serial: + +* Los eventos [`serial-port-added`](../api/session.md#event-serial-port-added) y [`serial-port-removed`](../api/session.md#event-serial-port-removed) en la Session pueden ser usados para maenjar dispositivos que están conectados o desconectados durante el proceso `navigator.serial.requestPort`. +* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler) puede ser usado para desactivar el acceso serial a orígenes específicos. + +### Ejemplo + +Este ejemplo demuestra una aplicación Electron que automáticamente selecciona el primer dispositivo serial Arduino Uno (si está conectado) a través del [evento `select-serial-port` en la Session](../api/session.md#event-select-serial-port) cuando el botón `Test Web Serial` es pulsado. + +```javascript fiddle='docs/fiddles/features/web-serial' + +``` diff --git a/content/es-ES/docs/tutorial/electron-timelines.md b/content/es-ES/docs/tutorial/electron-timelines.md index a9b48218a268f..b9a208fe305e1 100644 --- a/content/es-ES/docs/tutorial/electron-timelines.md +++ b/content/es-ES/docs/tutorial/electron-timelines.md @@ -1,6 +1,6 @@ # Tiempos de lanzamientos de Electron -Special notes: +Notas especiales: * Las fechas `-beta.1` y `stable` son nuestras fechas de lanzamiento sólidas. * Nos esforzamos por liberar versiones beta semanalmente, sin embargo a menudo liberamos mas betas que las programadas. diff --git a/content/es-ES/docs/tutorial/launch-app-from-url-in-another-app.md b/content/es-ES/docs/tutorial/launch-app-from-url-in-another-app.md index 1e7a16108d6a2..8a39f3427aa40 100644 --- a/content/es-ES/docs/tutorial/launch-app-from-url-in-another-app.md +++ b/content/es-ES/docs/tutorial/launch-app-from-url-in-another-app.md @@ -59,7 +59,7 @@ In this next step, we will create our `BrowserWindow` and tell our application 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 [aquí](https://www.electronjs.org/docs/api/app#apprequestsingleinstancelock). -#### Windows code: +#### Código de Windows: ```javascript const gotTheLock = app.requestSingleInstanceLock() @@ -68,26 +68,26 @@ if (!gotTheLock) { app.quit() } else { app.on('second-instance', (event, commandLine, workingDirectory) => { - // Someone tried to run a second instance, we should focus our window. + // Alguien trata de correr una segunda instancia, debemos enfocar nuestra ventana. if (mainWindow) { if (mainWindow.isMinimized()) mainWindow.restore() mainWindow.focus() } }) - // Create mainWindow, load the rest of the app, etc... + // Crear mainWindow, cargar el resto de la aplicación, etc... app.whenReady().then(() => { createWindow() }) - // Handle the protocol. In this case, we choose to show an Error Box. + // Handle the protocol. En este caso, elegimos mostrar una Caja de Error. app.on('open-url', (event, url) => { dialog.showErrorBox('Welcome Back', `You arrived from: ${url}`) }) } ``` -#### MacOS and Linux code: +#### Código MacOS y Linux: ```javascript // This method will be called when Electron has finished @@ -97,7 +97,7 @@ app.whenReady().then(() => { createWindow() }) -// Handle the protocol. In this case, we choose to show an Error Box. +// Handle the protocol. En este caso, elegimos mostrar una Caja de Error. app.on('open-url', (event, url) => { dialog.showErrorBox('Welcome Back', `You arrived from: ${url}`) }) diff --git a/content/es-ES/docs/tutorial/notifications.md b/content/es-ES/docs/tutorial/notifications.md index 07cc6695f512f..d011f0b6e0663 100644 --- a/content/es-ES/docs/tutorial/notifications.md +++ b/content/es-ES/docs/tutorial/notifications.md @@ -18,12 +18,12 @@ Starting with a working application from the [Quick Start Guide](quick-start.md) ``` -...and add the `renderer.js` file: +...y agregar el archivo `renderer.js`: ```javascript fiddle='docs/fiddles/features/notifications/renderer' -const NOTIFICATION_TITLE = 'Title' -const NOTIFICATION_BODY = 'Notification from the Renderer process. Click to log to console.' -const CLICK_MESSAGE = 'Notification clicked' +const NOTIFICATION_TITLE = 'Título' +const NOTIFICATION_BODY = 'Notificación del proceso de renderizado. Haga clic para registrar en consola.' +const CLICK_MESSAGE = 'Notification cliced' new Notification(NOTIFICATION_TITLE, { body: NOTIFICATION_BODY }) .onclick = () => console.log(CLICK_MESSAGE) @@ -56,7 +56,7 @@ After launching the Electron application, you should see the system notification ![Notification in the Main process](../images/notification-main.png) -## Additional information +## Información adiocional Si bien el código y la experiencia del usuario en los sistemas operativos son similares, existen diferencias sutiles. diff --git a/content/es-ES/docs/tutorial/performance.md b/content/es-ES/docs/tutorial/performance.md index f8ce40c5b3475..f4deb1d6c3171 100644 --- a/content/es-ES/docs/tutorial/performance.md +++ b/content/es-ES/docs/tutorial/performance.md @@ -151,7 +151,7 @@ Under no circumstances should you block this process and the UI thread with long 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. -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. +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. ### ¿Còmo? diff --git a/content/es-ES/docs/tutorial/support.md b/content/es-ES/docs/tutorial/support.md index 8c93b51773345..f0c267774a259 100644 --- a/content/es-ES/docs/tutorial/support.md +++ b/content/es-ES/docs/tutorial/support.md @@ -37,7 +37,7 @@ La última versión estable recibe unilateralmente todas las correcciones de `ma Todas las versiones soportadas aceptarán peticiones de pull requests externas a backport correcciones previamente fusionadas en `main`, 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 [Releases Working Group](https://github.com/electron/governance/tree/main/wg-releases) como un elemento de agenda en su reunión semanal la semana que se levanta el PR backport. -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. +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. ### Versiones soportadas actualmente diff --git a/content/fr-FR/docs/development/debugging-instructions-macos.md b/content/fr-FR/docs/development/debugging-instructions-macos.md index 5d61b698ee9e5..e51acfcbe22a6 100644 --- a/content/fr-FR/docs/development/debugging-instructions-macos.md +++ b/content/fr-FR/docs/development/debugging-instructions-macos.md @@ -11,7 +11,9 @@ Si vous rencontrez des crash ou des problèmes dans Electron et que vous croyez * **.lldbinit** : Créez ou éditez `~/.lldbinit` pour permettre au code Chromium d'être correctement source-mappé. ```text - import du script de commande ~/electron/src/tools/lldb/lldbinit.py + # e.g: ['~/electron/src/tools/lldb'] + script sys.path[:0] = ['<...path/to/electron/src/tools/lldb>'] + script import lldbinit ``` ## Débogage d'Electron diff --git a/content/fr-FR/docs/tutorial/devices.md b/content/fr-FR/docs/tutorial/devices.md new file mode 100644 index 0000000000000..657b3122f200c --- /dev/null +++ b/content/fr-FR/docs/tutorial/devices.md @@ -0,0 +1,56 @@ +# Accès au périphérique + +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. + +## API Web Bluetooth + +L’API [Web Bluetooth](https://web.dev/bluetooth/) 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 [`select-bluetooth-device` sur le webContents](../api/web-contents.md#event-select-bluetooth-device) associé à la demande de périphérique. + +### Example + +Cet exemple montre une application Electron qui sélectionne automatiquement le premier périphérique Bluetooth disponible lorsque le bouton `Test Bluetooth` est cliqué. + +```javascript fiddle='docs/fiddles/features/web-bluetooth' + +``` + +## WebHID API + +The [WebHID API](https://web.dev/hid/) can be used to access HID devices such as keyboards and gamepads. Electron provides several APIs for working with the WebHID API: + +* The [`select-hid-device` event on the Session](../api/session.md#event-select-hid-device) can be used to select a HID device when a call to `navigator.hid.requestDevice` is made. Additionally the [`hid-device-added`](../api/session.md#event-hid-device-added) and [`hid-device-removed`](../api/session.md#event-hid-device-removed) events on the Session can be used to handle devices being plugged in or unplugged during the `navigator.hid.requestDevice` process. +* [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler) can be used to provide default permissioning to devices without first calling for permission to devices via `navigator.hid.requestDevice`. 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 `select-hid-device` event) and then read from that storage with `setDevicePermissionHandler`. +* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler) can be used to disable HID access for specific origins. + +### Blocklist + +By default Electron employs the same [blocklist](https://github.com/WICG/webhid/blob/main/blocklist.txt) used by Chromium. If you wish to override this behavior, you can do so by setting the `disable-hid-blocklist` flag: + +```javascript +app.commandLine.appendSwitch('disable-hid-blocklist') +``` + +### Example + +This example demonstrates an Electron application that automatically selects HID devices through [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler) and through [`select-hid-device` event on the Session](../api/session.md#event-select-hid-device) when the `Test WebHID` button is clicked. + +```javascript fiddle='docs/fiddles/features/web-hid' + +``` + +## Web Serial API + +The [Web Serial API](https://web.dev/serial/) 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 [`select-serial-port` event on the Session](../api/session.md#event-select-serial-port) associated with the serial port request. + +There are several additional APIs for working with the Web Serial API: + +* The [`serial-port-added`](../api/session.md#event-serial-port-added) and [`serial-port-removed`](../api/session.md#event-serial-port-removed) events on the Session can be used to handle devices being plugged in or unplugged during the `navigator.serial.requestPort` process. +* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler) can be used to disable serial access for specific origins. + +### Example + +This example demonstrates an Electron application that automatically selects the first available Arduino Uno serial device (if connected) through [`select-serial-port` event on the Session](../api/session.md#event-select-serial-port) when the `Test Web Serial` button is clicked. + +```javascript fiddle='docs/fiddles/features/web-serial' + +``` diff --git a/content/ja-JP/docs/development/debugging-instructions-macos.md b/content/ja-JP/docs/development/debugging-instructions-macos.md index 207647176782e..4193bad303d49 100644 --- a/content/ja-JP/docs/development/debugging-instructions-macos.md +++ b/content/ja-JP/docs/development/debugging-instructions-macos.md @@ -11,7 +11,9 @@ JavaScript アプリケーションに起因しないと思われるクラッシ * **.lldbinit**: `~/.lldbinit` を以下のように作成及び編集し、Chromium コードを適切にソースマップできるようにします。 ```text - command script import ~/electron/src/tools/lldb/lldbinit.py + # e.g: ['~/electron/src/tools/lldb'] + script sys.path[:0] = ['<...path/to/electron/src/tools/lldb>'] + script import lldbinit ``` ## Electronへの接続とデバッグ diff --git a/content/ja-JP/docs/tutorial/devices.md b/content/ja-JP/docs/tutorial/devices.md new file mode 100644 index 0000000000000..fd1b1f0b1e9b1 --- /dev/null +++ b/content/ja-JP/docs/tutorial/devices.md @@ -0,0 +1,56 @@ +# Device Access + +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. + +## Web Bluetooth API + +The [Web Bluetooth API](https://web.dev/bluetooth/) can be used to communicate with bluetooth devices. In order to use this API in Electron, developers will need to handle the [`select-bluetooth-device` event on the webContents](../api/web-contents.md#event-select-bluetooth-device) associated with the device request. + +### サンプル + +This example demonstrates an Electron application that automatically selects the first available bluetooth device when the `Test Bluetooth` button is clicked. + +```javascript fiddle='docs/fiddles/features/web-bluetooth' + +``` + +## WebHID API + +The [WebHID API](https://web.dev/hid/) can be used to access HID devices such as keyboards and gamepads. Electron provides several APIs for working with the WebHID API: + +* The [`select-hid-device` event on the Session](../api/session.md#event-select-hid-device) can be used to select a HID device when a call to `navigator.hid.requestDevice` is made. Additionally the [`hid-device-added`](../api/session.md#event-hid-device-added) and [`hid-device-removed`](../api/session.md#event-hid-device-removed) events on the Session can be used to handle devices being plugged in or unplugged during the `navigator.hid.requestDevice` process. +* [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler) can be used to provide default permissioning to devices without first calling for permission to devices via `navigator.hid.requestDevice`. 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 `select-hid-device` event) and then read from that storage with `setDevicePermissionHandler`. +* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler) can be used to disable HID access for specific origins. + +### Blocklist + +By default Electron employs the same [blocklist](https://github.com/WICG/webhid/blob/main/blocklist.txt) used by Chromium. If you wish to override this behavior, you can do so by setting the `disable-hid-blocklist` flag: + +```javascript +app.commandLine.appendSwitch('disable-hid-blocklist') +``` + +### サンプル + +This example demonstrates an Electron application that automatically selects HID devices through [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler) and through [`select-hid-device` event on the Session](../api/session.md#event-select-hid-device) when the `Test WebHID` button is clicked. + +```javascript fiddle='docs/fiddles/features/web-hid' + +``` + +## Web Serial API + +The [Web Serial API](https://web.dev/serial/) 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 [`select-serial-port` event on the Session](../api/session.md#event-select-serial-port) associated with the serial port request. + +There are several additional APIs for working with the Web Serial API: + +* The [`serial-port-added`](../api/session.md#event-serial-port-added) and [`serial-port-removed`](../api/session.md#event-serial-port-removed) events on the Session can be used to handle devices being plugged in or unplugged during the `navigator.serial.requestPort` process. +* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler) can be used to disable serial access for specific origins. + +### サンプル + +This example demonstrates an Electron application that automatically selects the first available Arduino Uno serial device (if connected) through [`select-serial-port` event on the Session](../api/session.md#event-select-serial-port) when the `Test Web Serial` button is clicked. + +```javascript fiddle='docs/fiddles/features/web-serial' + +``` diff --git a/content/pt-BR/docs/development/debugging-instructions-macos.md b/content/pt-BR/docs/development/debugging-instructions-macos.md index 3786478706db5..e7a0e49381147 100644 --- a/content/pt-BR/docs/development/debugging-instructions-macos.md +++ b/content/pt-BR/docs/development/debugging-instructions-macos.md @@ -11,7 +11,9 @@ Se experimentar falhas ou problemas no Electron que acredita que não são causa * **.lldbinit**: Create or edit `~/.lldbinit` to allow Chromium code to be properly source-mapped. ```text - command script import ~/electron/src/tools/lldb/lldbinit.py + # e.g: ['~/electron/src/tools/lldb'] + script sys.path[:0] = ['<...path/to/electron/src/tools/lldb>'] + script import lldbinit ``` ## Anexar e depurar o Electron diff --git a/content/pt-BR/docs/tutorial/devices.md b/content/pt-BR/docs/tutorial/devices.md new file mode 100644 index 0000000000000..33a9905dd26f3 --- /dev/null +++ b/content/pt-BR/docs/tutorial/devices.md @@ -0,0 +1,56 @@ +# Device Access + +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. + +## Web Bluetooth API + +The [Web Bluetooth API](https://web.dev/bluetooth/) can be used to communicate with bluetooth devices. In order to use this API in Electron, developers will need to handle the [`select-bluetooth-device` event on the webContents](../api/web-contents.md#event-select-bluetooth-device) associated with the device request. + +### Exemplo + +This example demonstrates an Electron application that automatically selects the first available bluetooth device when the `Test Bluetooth` button is clicked. + +```javascript fiddle='docs/fiddles/features/web-bluetooth' + +``` + +## WebHID API + +The [WebHID API](https://web.dev/hid/) can be used to access HID devices such as keyboards and gamepads. Electron provides several APIs for working with the WebHID API: + +* The [`select-hid-device` event on the Session](../api/session.md#event-select-hid-device) can be used to select a HID device when a call to `navigator.hid.requestDevice` is made. Additionally the [`hid-device-added`](../api/session.md#event-hid-device-added) and [`hid-device-removed`](../api/session.md#event-hid-device-removed) events on the Session can be used to handle devices being plugged in or unplugged during the `navigator.hid.requestDevice` process. +* [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler) can be used to provide default permissioning to devices without first calling for permission to devices via `navigator.hid.requestDevice`. 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 `select-hid-device` event) and then read from that storage with `setDevicePermissionHandler`. +* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler) can be used to disable HID access for specific origins. + +### Blocklist + +By default Electron employs the same [blocklist](https://github.com/WICG/webhid/blob/main/blocklist.txt) used by Chromium. If you wish to override this behavior, you can do so by setting the `disable-hid-blocklist` flag: + +```javascript +app.commandLine.appendSwitch('disable-hid-blocklist') +``` + +### Exemplo + +This example demonstrates an Electron application that automatically selects HID devices through [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler) and through [`select-hid-device` event on the Session](../api/session.md#event-select-hid-device) when the `Test WebHID` button is clicked. + +```javascript fiddle='docs/fiddles/features/web-hid' + +``` + +## Web Serial API + +The [Web Serial API](https://web.dev/serial/) 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 [`select-serial-port` event on the Session](../api/session.md#event-select-serial-port) associated with the serial port request. + +There are several additional APIs for working with the Web Serial API: + +* The [`serial-port-added`](../api/session.md#event-serial-port-added) and [`serial-port-removed`](../api/session.md#event-serial-port-removed) events on the Session can be used to handle devices being plugged in or unplugged during the `navigator.serial.requestPort` process. +* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler) can be used to disable serial access for specific origins. + +### Exemplo + +This example demonstrates an Electron application that automatically selects the first available Arduino Uno serial device (if connected) through [`select-serial-port` event on the Session](../api/session.md#event-select-serial-port) when the `Test Web Serial` button is clicked. + +```javascript fiddle='docs/fiddles/features/web-serial' + +``` diff --git a/content/ru-RU/docs/development/debugging-instructions-macos.md b/content/ru-RU/docs/development/debugging-instructions-macos.md index 8ce75df9b4e77..f4352e50ba5ad 100644 --- a/content/ru-RU/docs/development/debugging-instructions-macos.md +++ b/content/ru-RU/docs/development/debugging-instructions-macos.md @@ -11,7 +11,9 @@ * **.lldbinit**: Create or edit `~/.lldbinit` to allow Chromium code to be properly source-mapped. ```text - скрипт команды импортирует ~/electron/src/tools/lldb/lldbinit.py. 07gf + # e.g: ['~/electron/src/tools/lldb'] + script sys.path[:0] = ['<...path/to/electron/src/tools/lldb>'] + script import lldbinit ``` ## Подключение к Electron для отладки diff --git a/content/ru-RU/docs/tutorial/devices.md b/content/ru-RU/docs/tutorial/devices.md new file mode 100644 index 0000000000000..7d682264ed4e8 --- /dev/null +++ b/content/ru-RU/docs/tutorial/devices.md @@ -0,0 +1,56 @@ +# Device Access + +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. + +## Web Bluetooth API + +The [Web Bluetooth API](https://web.dev/bluetooth/) can be used to communicate with bluetooth devices. In order to use this API in Electron, developers will need to handle the [`select-bluetooth-device` event on the webContents](../api/web-contents.md#event-select-bluetooth-device) associated with the device request. + +### Пример + +This example demonstrates an Electron application that automatically selects the first available bluetooth device when the `Test Bluetooth` button is clicked. + +```javascript fiddle='docs/fiddles/features/web-bluetooth' + +``` + +## WebHID API + +The [WebHID API](https://web.dev/hid/) can be used to access HID devices such as keyboards and gamepads. Electron provides several APIs for working with the WebHID API: + +* The [`select-hid-device` event on the Session](../api/session.md#event-select-hid-device) can be used to select a HID device when a call to `navigator.hid.requestDevice` is made. Additionally the [`hid-device-added`](../api/session.md#event-hid-device-added) and [`hid-device-removed`](../api/session.md#event-hid-device-removed) events on the Session can be used to handle devices being plugged in or unplugged during the `navigator.hid.requestDevice` process. +* [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler) can be used to provide default permissioning to devices without first calling for permission to devices via `navigator.hid.requestDevice`. 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 `select-hid-device` event) and then read from that storage with `setDevicePermissionHandler`. +* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler) can be used to disable HID access for specific origins. + +### Blocklist + +By default Electron employs the same [blocklist](https://github.com/WICG/webhid/blob/main/blocklist.txt) used by Chromium. If you wish to override this behavior, you can do so by setting the `disable-hid-blocklist` flag: + +```javascript +app.commandLine.appendSwitch('disable-hid-blocklist') +``` + +### Пример + +This example demonstrates an Electron application that automatically selects HID devices through [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler) and through [`select-hid-device` event on the Session](../api/session.md#event-select-hid-device) when the `Test WebHID` button is clicked. + +```javascript fiddle='docs/fiddles/features/web-hid' + +``` + +## Web Serial API + +The [Web Serial API](https://web.dev/serial/) 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 [`select-serial-port` event on the Session](../api/session.md#event-select-serial-port) associated with the serial port request. + +There are several additional APIs for working with the Web Serial API: + +* The [`serial-port-added`](../api/session.md#event-serial-port-added) and [`serial-port-removed`](../api/session.md#event-serial-port-removed) events on the Session can be used to handle devices being plugged in or unplugged during the `navigator.serial.requestPort` process. +* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler) can be used to disable serial access for specific origins. + +### Пример + +This example demonstrates an Electron application that automatically selects the first available Arduino Uno serial device (if connected) through [`select-serial-port` event on the Session](../api/session.md#event-select-serial-port) when the `Test Web Serial` button is clicked. + +```javascript fiddle='docs/fiddles/features/web-serial' + +``` diff --git a/content/zh-CN/docs/development/debugging-instructions-macos.md b/content/zh-CN/docs/development/debugging-instructions-macos.md index b819bf8879646..4023bfc0cabc1 100644 --- a/content/zh-CN/docs/development/debugging-instructions-macos.md +++ b/content/zh-CN/docs/development/debugging-instructions-macos.md @@ -11,7 +11,9 @@ * **.lldbinit**: Create or edit `~/.lldbinit` to allow Chromium code to be properly source-mapped. ```text - command script import ~/electron/src/tools/lldb/lldbinit.py + # e.g: ['~/electron/src/tools/lldb'] + script sys.path[:0] = ['<...path/to/electron/src/tools/lldb>'] + script import lldbinit ``` ## 附加并调试 Electron diff --git a/content/zh-CN/docs/tutorial/devices.md b/content/zh-CN/docs/tutorial/devices.md new file mode 100644 index 0000000000000..3f91309a0340f --- /dev/null +++ b/content/zh-CN/docs/tutorial/devices.md @@ -0,0 +1,56 @@ +# Device Access + +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. + +## Web Bluetooth API + +The [Web Bluetooth API](https://web.dev/bluetooth/) can be used to communicate with bluetooth devices. In order to use this API in Electron, developers will need to handle the [`select-bluetooth-device` event on the webContents](../api/web-contents.md#event-select-bluetooth-device) associated with the device request. + +### 示例 + +This example demonstrates an Electron application that automatically selects the first available bluetooth device when the `Test Bluetooth` button is clicked. + +```javascript fiddle='docs/fiddles/features/web-bluetooth' + +``` + +## WebHID API + +The [WebHID API](https://web.dev/hid/) can be used to access HID devices such as keyboards and gamepads. Electron provides several APIs for working with the WebHID API: + +* The [`select-hid-device` event on the Session](../api/session.md#event-select-hid-device) can be used to select a HID device when a call to `navigator.hid.requestDevice` is made. Additionally the [`hid-device-added`](../api/session.md#event-hid-device-added) and [`hid-device-removed`](../api/session.md#event-hid-device-removed) events on the Session can be used to handle devices being plugged in or unplugged during the `navigator.hid.requestDevice` process. +* [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler) can be used to provide default permissioning to devices without first calling for permission to devices via `navigator.hid.requestDevice`. 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 `select-hid-device` event) and then read from that storage with `setDevicePermissionHandler`. +* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler) can be used to disable HID access for specific origins. + +### Blocklist + +By default Electron employs the same [blocklist](https://github.com/WICG/webhid/blob/main/blocklist.txt) used by Chromium. If you wish to override this behavior, you can do so by setting the `disable-hid-blocklist` flag: + +```javascript +app.commandLine.appendSwitch('disable-hid-blocklist') +``` + +### 示例 + +This example demonstrates an Electron application that automatically selects HID devices through [`ses.setDevicePermissionHandler(handler)`](../api/session.md#sessetdevicepermissionhandlerhandler) and through [`select-hid-device` event on the Session](../api/session.md#event-select-hid-device) when the `Test WebHID` button is clicked. + +```javascript fiddle='docs/fiddles/features/web-hid' + +``` + +## Web Serial API + +The [Web Serial API](https://web.dev/serial/) 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 [`select-serial-port` event on the Session](../api/session.md#event-select-serial-port) associated with the serial port request. + +There are several additional APIs for working with the Web Serial API: + +* The [`serial-port-added`](../api/session.md#event-serial-port-added) and [`serial-port-removed`](../api/session.md#event-serial-port-removed) events on the Session can be used to handle devices being plugged in or unplugged during the `navigator.serial.requestPort` process. +* [`ses.setPermissionCheckHandler(handler)`](../api/session.md#sessetpermissioncheckhandlerhandler) can be used to disable serial access for specific origins. + +### 示例 + +This example demonstrates an Electron application that automatically selects the first available Arduino Uno serial device (if connected) through [`select-serial-port` event on the Session](../api/session.md#event-select-serial-port) when the `Test Web Serial` button is clicked. + +```javascript fiddle='docs/fiddles/features/web-serial' + +```